## mako

<%namespace name='static' file='../static_content.html'/>

<%page expression_filter="h"/>

<%!
import json
from django.utils.translation import gettext as _
from django.template.defaultfilters import escapejs
from django.urls import reverse

from lms.djangoapps.discussion.django_comment_client.permissions import has_permission
from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_string
from openedx.core.djangolib.markup import HTML
%>

<section class="discussion discussion-board page-content-container" id="discussion-container"
         data-course-id="${course.id}"
         data-user-create-comment="${json.dumps(can_create_comment)}"
         data-user-create-subcomment="${json.dumps(can_create_subcomment)}"
         data-read-only="false"
         data-sort-preference="${sort_preference}"
         data-flag-moderator="${json.dumps(flag_moderator)}"
         data-user-group-id="${user_group_id}">
    <header class="page-header has-secondary">
        ## Breadcrumb navigation
        <div class="page-header-main">
            <nav aria-label="${_('Discussions')}" class="sr-is-focusable" tabindex="-1">
                <div class="has-breadcrumbs"></div>
            </nav>
        </div>
        <div class="page-header-secondary">
            ## Add Post button
            % if has_permission(user, 'create_thread', course.id):
            <div class="forum-actions">
                <button class="btn btn-outline-primary btn-small new-post-btn">${_("Add a Post")}</button>
            </div>
            % endif
            ## Search box
            <div class="forum-search"></div>
        </div>
    </header>
    % if course_expiration_fragment:
        ${HTML(course_expiration_fragment.content)}
    % endif
    <div class="page-content"
      % if getattr(course, 'language'):
        lang="${course.language}"
      % endif
    >
        <div class="discussion-body">
            <main id="main" class="discussion-column" aria-label="Content" tabindex="-1">
                <article class="new-post-article is-hidden" style="display: none" tabindex="-1" aria-label="${_("New topic form")}"></article>
                <div class="forum-content"></div>
            </main>
            <aside class="forum-nav" role="complementary" aria-label="${_("Discussion thread list")}">
                <%include file="_filter_dropdown.html" />
                <div class="discussion-thread-list-container"></div>
            </aside>
        </div>
    </div>
</section>

<%include file="_underscore_templates.html" />
<%include file="_thread_list_template.html" />

<%static:require_module_async module_name="js/commerce/track_ecommerce_events" class_name="TrackECommerceEvents">

  var fbeLink = $("#FBE_banner");

  TrackECommerceEvents.trackUpsellClick(fbeLink, 'discussion_audit_access_expires', {
      pageName: "discussion_tab",
      linkType: "link",
      linkCategory: "FBE_banner"
  });

</%static:require_module_async>
